#include <iostream>
#include <vector>

class Solution {
public:
    static int maxArea(std::vector<int>& height) {
        int left = 0;
        int right = height.size()-1;
        int max = 0;
        while(left != right)
        {
            int v = 0;
            if(height[left] <= height[right])
            {
                v = height[left]*(right-left);
                left++;
            }
            else
            {
                v = height[right]*(right-left);
                right--;
            }
            if(v > max) max = v;
        }
        return max;
    }
};

int main()
{
    std::vector<int> vc = {1,8,6,2,5,4,8,3,7};
    std::cout << (Solution::maxArea(vc) == 49) << std::endl;
    return 0;
}